﻿<UserControl x:Class="BioPatMLEditor.PatternControls.PatternBuilderPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:toolkit="System.Windows.Controls.Toolkit"
    xmlns:msWindows="clr-namespace:Microsoft.Windows;assembly=System.Windows.Controls.Toolkit"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls"
    xmlns:dataFormToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    Width="960" Height="550">
    <UserControl.Resources>
        <Storyboard x:Name="BlinkLoading">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="txtLoading">
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:4" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" ShowGridLines="false" RenderTransformOrigin="0.5,0.5">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="450"/>
            <ColumnDefinition Width="auto" MinWidth="510"/>
        </Grid.ColumnDefinitions>

        <controls:TabControl x:Name="tabControl" Grid.Column="0"  Margin="0,0,-62,0" RenderTransformOrigin="0.5,0.5">
            <controls:TabControl.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF091623" Offset="0.789"/>
                    <GradientStop Color="#FF0B1A4B" Offset="0.978"/>
                    <GradientStop Color="#FF0E2945" Offset="1"/>
                    <GradientStop Color="#FF112235" Offset="0.897"/>
                </LinearGradientBrush>
            </controls:TabControl.Background>

            <controls:TabItem Header="Graphical View">

                <Canvas x:Name="canvas" Width="auto" Height="auto" RenderTransformOrigin="0.5,0.5">
                    <Canvas.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF091623" Offset="0.578"/>
                            <GradientStop Color="#FF10263B" Offset="0.922"/>
                        </LinearGradientBrush>
                    </Canvas.Background>
                    <Canvas.RenderTransform>
                        <CompositeTransform/>
                    </Canvas.RenderTransform>
                    <Image Height="70" Canvas.Left="200" Canvas.Top="10" Name="image1" Stretch="Fill" Width="280" Source="/SilverBioPatMLEditor;component/ImgResources/EditorGraphic.png" />
                    <TextBox x:Name="lblDesignViewTitle" Text="BioPatML Designer" Background="{x:Null}" FontSize="16" Foreground="#FFC3C3C3" Canvas.ZIndex="1" Canvas.Left="20" Canvas.Top="41" IsReadOnly="True"/>
                    <Border Height="418" Width="450" Canvas.Left="14" Canvas.Top="87" BorderBrush="Black" BorderThickness="1" CornerRadius="6">
                        <Canvas Margin="196,48,18,7">
                            <TextBox Text="Pattern Annotations" Canvas.Left="55" Foreground="White" Width="124" Canvas.ZIndex="1" Background="Black" BorderBrush="{x:Null}" VerticalAlignment="Center"/>
                            <Border Height="312" Width="234" BorderBrush="White" BorderThickness="1" CornerRadius="6" Background="Black" Canvas.Top="-9" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <data:DataGrid ItemsSource="{Binding}" Background="Black" HorizontalGridLinesBrush="White" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="13,36,0,0">
                                    <data:DataGrid.Columns>
                                        <data:DataGridTextColumn Header="Subject" Foreground="Black" IsReadOnly="True" Width="100" />
                                        <data:DataGridTextColumn Header="value" IsReadOnly="True" Width="110" />
                                    </data:DataGrid.Columns>
                                </data:DataGrid>
                            </Border>
                            <Button Content="Clear Pattern" Canvas.Top="316" Width="100" Canvas.Left="8" Opacity="0.6" Foreground="Black" BorderBrush="Black"/>
                            <Button x:Name="btnImplement" Content="Implement Pattern" Canvas.Left="116" Canvas.Top="316" Width="110" RenderTransformOrigin="0.473,0.455" BorderBrush="Black" Background="#FF1F3B53" Foreground="Black" Opacity="0.6" Click="btnImplement_Click" />
                        </Canvas>
                    </Border>
                    <controlsToolkit:TreeViewDragDropTarget Name="Test" AllowDrop="true" Canvas.Left="20" Canvas.Top="130" Drop="TreeViewDragDropTarget_Drop" >

                        <controls:TreeView Height="360" Width="163" Background="Black" BorderBrush="White" Foreground="White" x:Name="PatternViewTree" HorizontalAlignment="Center">
                            <controls:TreeView.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" >
                                        <Button Content="{Binding BioPatternName}" Click="Button_Click"  VerticalAlignment="Center" Height="40" RenderTransformOrigin="0.5,0.5" Width="100" Margin="0,20,0,0" Cursor="Hand">
                                            <Button.RenderTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="-1" ScaleY="-1"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="-180"/>
                                                    <TranslateTransform/>
                                                </TransformGroup>
                                            </Button.RenderTransform>
                                        </Button>
                                    </StackPanel>
                                </DataTemplate>
                            </controls:TreeView.ItemTemplate>

                            <controls:TreeViewItem Header="Pattern Structure"  RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" Margin="0" Background="{x:Null}"  Foreground="White" HorizontalAlignment="Left">
                                <controls:TreeViewItem.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="-1" ScaleY="-1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="180"/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </controls:TreeViewItem.RenderTransform>
                            </controls:TreeViewItem>
                        </controls:TreeView>

                    </controlsToolkit:TreeViewDragDropTarget>
                    <TextBlock x:Name="txtLoading" Foreground="#FF2B2EFF" Text="Loading..." Canvas.Top="197" Canvas.Left="54" FontSize="18.667" Visibility="Collapsed"/>

                    <!-- Annotation part -->
                </Canvas>

            </controls:TabItem>

            <controls:TabItem MouseLeftButtonUp="TabItem_MouseLeftButtonUp"  Header="Technical View" Background="Black">
                <Canvas Width="auto" Height="auto">
                    <TextBox x:Name="lblDesignViewTitle2" Text="Bio Technical View" Background="{x:Null}" FontSize="16" Foreground="#FFC3C3C3" Canvas.ZIndex="1" Canvas.Left="20" Canvas.Top="41"/>
                    <RichTextBox x:Name="txtXMLPanel" Height="410" Canvas.Left="20" Canvas.Top="95" Width="472" HorizontalScrollBarVisibility="Auto" Background="Black" FontSize="12" Foreground="White" FontFamily="Courier New" TextWrapping="NoWrap" CaretBrush="White" />
                    <Image Canvas.Left="200" Canvas.Top="10" Height="70" Name="image2" Source="/SilverBioPatMLEditor;component/ImgResources/EditorGraphic.png" Stretch="Fill" Width="280" />
                </Canvas>
            </controls:TabItem>

        </controls:TabControl>

        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"  Grid.Column="1" HorizontalAlignment="Right" Width="266" Margin="0,0,128,0">
            <Canvas Width="215" HorizontalAlignment="Left" Margin="20,0,0,0" >

                <Border Height="487" Width="210" BorderThickness="3" CornerRadius="5" BorderBrush="#FFA25012" HorizontalAlignment="Left" Canvas.Left="3" Canvas.Top="35">
                    <Border BorderBrush="Black" BorderThickness="1" Margin="6,34,6,6" CornerRadius="5">
                        <ScrollViewer HorizontalScrollBarVisibility="Auto"  VerticalScrollBarVisibility="Auto"  Grid.Column="1" HorizontalAlignment="Right" Width="185" Margin="0,0,5,0">
                            <Grid Width="auto" Height="auto">
                                <!-- We define our grid resource now, they are mainly the codes for fading in/out for our expander control -->
                                <Grid.Resources>
                                    <!-- Start Resource -->
                                    <Style x:Key="ExpanderFadeStyle" TargetType="controlsToolkit:Expander">
                                        <Setter Property="Background" Value="Transparent"/>
                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                        <Setter Property="BorderThickness" Value="1"/>
                                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="controlsToolkit:Expander">
                                                    <Grid Background="Transparent">
                                                        <Grid.Resources>
                                                            <LinearGradientBrush x:Key="ExpanderArrowFill" EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="White" Offset="0"/>
                                                                <GradientStop Color="#FFBFBFBF" Offset="0.5"/>
                                                                <GradientStop Color="#FF878787" Offset="1"/>
                                                            </LinearGradientBrush>
                                                            <LinearGradientBrush x:Key="ExpanderArrowHoverFill" EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="#FFF0F8FE" Offset="0"/>
                                                                <GradientStop Color="#FFE0F3FE" Offset="0.3"/>
                                                                <GradientStop Color="#FF6FA7C5" Offset="1"/>
                                                            </LinearGradientBrush>
                                                            <LinearGradientBrush x:Key="ExpanderArrowPressedFill" EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="#FFDCF0FA" Offset="0"/>
                                                                <GradientStop Color="#FFC5E6F7" Offset="0.2"/>
                                                                <GradientStop Color="#FF5690D0" Offset="1"/>
                                                            </LinearGradientBrush>
                                                            <ControlTemplate x:Key="ExpanderDownHeaderTemplate" TargetType="ToggleButton">
                                                                <Grid Background="Transparent">
                                                                    <vsm:VisualStateManager.VisualStateGroups>
                                                                        <vsm:VisualStateGroup x:Name="CheckStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Checked">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="Data">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unchecked"/>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="0"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Normal"/>
                                                                            <vsm:VisualState x:Name="MouseOver">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF3C7FB1"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowHoverFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#222"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Pressed">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF526C7B"/>
                                                                                    <DoubleAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="StrokeThickness" To="1.5"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowPressedFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#FF003366"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="FocusStates">
                                                                            <vsm:VisualState x:Name="Focused">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unfocused"/>
                                                                        </vsm:VisualStateGroup>
                                                                    </vsm:VisualStateManager.VisualStateGroups>
                                                                    <Border Padding="{TemplateBinding Padding}">
                                                                        <Grid Background="Transparent">
                                                                            <Grid.ColumnDefinitions>
                                                                                <ColumnDefinition Width="19"/>
                                                                                <ColumnDefinition Width="*"/>
                                                                            </Grid.ColumnDefinitions>
                                                                            <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
                                                                                <Ellipse Fill="{StaticResource ExpanderArrowFill}" Height="19" HorizontalAlignment="Center" x:Name="circle" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
                                                                                <Path Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" x:Name="arrow" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
                                                                            </Grid>
                                                                            <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" x:Name="header" VerticalAlignment="Center"/>
                                                                        </Grid>
                                                                    </Border>
                                                                    <Rectangle IsHitTestVisible="false" x:Name="FocusVisualElement" Stroke="Green" StrokeDashArray="1 2" StrokeThickness="1" Visibility="Collapsed"/>
                                                                </Grid>
                                                            </ControlTemplate>
                                                            <ControlTemplate x:Key="ExpanderUpHeaderTemplate" TargetType="ToggleButton">
                                                                <Grid Background="Transparent">
                                                                    <vsm:VisualStateManager.VisualStateGroups>
                                                                        <vsm:VisualStateGroup x:Name="CheckStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Checked">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="Data">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unchecked"/>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="0"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Normal"/>
                                                                            <vsm:VisualState x:Name="MouseOver">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF3C7FB1"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowHoverFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#222"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Pressed">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF526C7B"/>
                                                                                    <DoubleAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="StrokeThickness" To="1.5"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowPressedFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#FF003366"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="FocusStates">
                                                                            <vsm:VisualState x:Name="Focused">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unfocused"/>
                                                                        </vsm:VisualStateGroup>
                                                                    </vsm:VisualStateManager.VisualStateGroups>
                                                                    <Border Padding="{TemplateBinding Padding}">
                                                                        <Grid Background="Transparent">
                                                                            <Grid.ColumnDefinitions>
                                                                                <ColumnDefinition Width="19"/>
                                                                                <ColumnDefinition Width="*"/>
                                                                            </Grid.ColumnDefinitions>
                                                                            <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
                                                                                <Grid.RenderTransform>
                                                                                    <TransformGroup>
                                                                                        <TransformGroup.Children>
                                                                                            <TransformCollection>
                                                                                                <RotateTransform Angle="180" CenterX="9.5" CenterY="9.5"/>
                                                                                            </TransformCollection>
                                                                                        </TransformGroup.Children>
                                                                                    </TransformGroup>
                                                                                </Grid.RenderTransform>
                                                                                <Ellipse Fill="{StaticResource ExpanderArrowFill}" Height="19" HorizontalAlignment="Center" x:Name="circle" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
                                                                                <Path Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" x:Name="arrow" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
                                                                            </Grid>
                                                                            <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" x:Name="header" VerticalAlignment="Center"/>
                                                                        </Grid>
                                                                    </Border>
                                                                    <Rectangle IsHitTestVisible="false" x:Name="FocusVisualElement" Stroke="Green" StrokeDashArray="1 2" StrokeThickness="1" Visibility="Collapsed"/>
                                                                </Grid>
                                                            </ControlTemplate>
                                                            <ControlTemplate x:Key="ExpanderLeftHeaderTemplate" TargetType="ToggleButton">
                                                                <Grid Background="Transparent">
                                                                    <vsm:VisualStateManager.VisualStateGroups>
                                                                        <vsm:VisualStateGroup x:Name="CheckStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Checked">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="Data">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unchecked"/>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="0"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Normal"/>
                                                                            <vsm:VisualState x:Name="MouseOver">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF3C7FB1"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowHoverFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#222"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Pressed">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF526C7B"/>
                                                                                    <DoubleAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="StrokeThickness" To="1.5"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowPressedFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#FF003366"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="FocusStates">
                                                                            <vsm:VisualState x:Name="Focused">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unfocused"/>
                                                                        </vsm:VisualStateGroup>
                                                                    </vsm:VisualStateManager.VisualStateGroups>
                                                                    <Border Padding="{TemplateBinding Padding}">
                                                                        <Grid Background="Transparent">
                                                                            <Grid.RowDefinitions>
                                                                                <RowDefinition Height="19"/>
                                                                                <RowDefinition Height="*"/>
                                                                            </Grid.RowDefinitions>
                                                                            <Grid HorizontalAlignment="Center" VerticalAlignment="Top">
                                                                                <Grid.RenderTransform>
                                                                                    <TransformGroup>
                                                                                        <TransformGroup.Children>
                                                                                            <TransformCollection>
                                                                                                <RotateTransform Angle="90" CenterX="9.5" CenterY="9.5"/>
                                                                                            </TransformCollection>
                                                                                        </TransformGroup.Children>
                                                                                    </TransformGroup>
                                                                                </Grid.RenderTransform>
                                                                                <Ellipse Fill="{StaticResource ExpanderArrowFill}" Height="19" HorizontalAlignment="Center" x:Name="circle" Width="19" Stroke="DarkGray" VerticalAlignment="Center"/>
                                                                                <Path Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" x:Name="arrow" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
                                                                            </Grid>
                                                                            <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Row="1" HorizontalAlignment="Center" Margin="0,4,0,0" x:Name="header" VerticalAlignment="Top"/>
                                                                        </Grid>
                                                                    </Border>
                                                                    <Rectangle IsHitTestVisible="false" x:Name="FocusVisualElement" Stroke="Green" StrokeDashArray="1 2" StrokeThickness="1" Visibility="Collapsed"/>
                                                                </Grid>
                                                            </ControlTemplate>
                                                            <ControlTemplate x:Key="ExpanderRightHeaderTemplate" TargetType="ToggleButton">
                                                                <Grid Background="Transparent">
                                                                    <vsm:VisualStateManager.VisualStateGroups>
                                                                        <vsm:VisualStateGroup x:Name="CheckStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Checked">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="Data">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unchecked"/>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                                                            <vsm:VisualStateGroup.Transitions>
                                                                                <vsm:VisualTransition GeneratedDuration="0"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
                                                                                <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
                                                                            </vsm:VisualStateGroup.Transitions>
                                                                            <vsm:VisualState x:Name="Normal"/>
                                                                            <vsm:VisualState x:Name="MouseOver">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF3C7FB1"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowHoverFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#222"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Pressed">
                                                                                <Storyboard>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)" To="#FF526C7B"/>
                                                                                    <DoubleAnimation BeginTime="0" Storyboard.TargetName="circle" Storyboard.TargetProperty="StrokeThickness" To="1.5"/>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle" Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderArrowPressedFill}"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ColorAnimation BeginTime="0" Storyboard.TargetName="arrow" Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)" To="#FF003366"/>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                        </vsm:VisualStateGroup>
                                                                        <vsm:VisualStateGroup x:Name="FocusStates">
                                                                            <vsm:VisualState x:Name="Focused">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </vsm:VisualState>
                                                                            <vsm:VisualState x:Name="Unfocused"/>
                                                                        </vsm:VisualStateGroup>
                                                                    </vsm:VisualStateManager.VisualStateGroups>
                                                                    <Border Padding="{TemplateBinding Padding}">
                                                                        <Grid Background="Transparent">
                                                                            <Grid.RowDefinitions>
                                                                                <RowDefinition Height="19"/>
                                                                                <RowDefinition Height="*"/>
                                                                            </Grid.RowDefinitions>
                                                                            <Grid HorizontalAlignment="Center" VerticalAlignment="Top">
                                                                                <Grid.RenderTransform>
                                                                                    <TransformGroup>
                                                                                        <TransformGroup.Children>
                                                                                            <TransformCollection>
                                                                                                <RotateTransform Angle="270" CenterX="9.5" CenterY="9.5"/>
                                                                                            </TransformCollection>
                                                                                        </TransformGroup.Children>
                                                                                    </TransformGroup>
                                                                                </Grid.RenderTransform>
                                                                                <Ellipse Fill="{StaticResource ExpanderArrowFill}" Height="19" HorizontalAlignment="Center" x:Name="circle" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
                                                                                <Path Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" x:Name="arrow" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
                                                                            </Grid>
                                                                            <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Row="1" HorizontalAlignment="Center" Margin="0,4,0,0" x:Name="header" VerticalAlignment="Top"/>
                                                                        </Grid>
                                                                    </Border>
                                                                    <Rectangle IsHitTestVisible="false" x:Name="FocusVisualElement" Stroke="Green" StrokeDashArray="1 2" StrokeThickness="1" Visibility="Collapsed"/>
                                                                </Grid>
                                                            </ControlTemplate>
                                                        </Grid.Resources>
                                                        <vsm:VisualStateManager.VisualStateGroups>
                                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                                <vsm:VisualStateGroup.Transitions>
                                                                    <vsm:VisualTransition GeneratedDuration="0"/>
                                                                </vsm:VisualStateGroup.Transitions>
                                                                <vsm:VisualState x:Name="Normal"/>
                                                                <vsm:VisualState x:Name="Disabled">
                                                                    <Storyboard>
                                                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                            </vsm:VisualStateGroup>
                                                            <vsm:VisualStateGroup x:Name="FocusStates">
                                                                <vsm:VisualState x:Name="Focused">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                                <vsm:VisualState x:Name="Unfocused"/>
                                                            </vsm:VisualStateGroup>
                                                            <vsm:VisualStateGroup x:Name="ExpansionStates">
                                                                <vsm:VisualStateGroup.Transitions>
                                                                    <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"/>
                                                                </vsm:VisualStateGroup.Transitions>
                                                                <vsm:VisualState x:Name="Collapsed">
                                                                    <Storyboard>
                                                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                                                        </DoubleAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                                <vsm:VisualState x:Name="Expanded"/>
                                                            </vsm:VisualStateGroup>
                                                            <vsm:VisualStateGroup x:Name="ExpandDirectionStates">
                                                                <vsm:VisualStateGroup.Transitions>
                                                                    <vsm:VisualTransition GeneratedDuration="0"/>
                                                                </vsm:VisualStateGroup.Transitions>
                                                                <vsm:VisualState x:Name="ExpandDown">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="rd1" Storyboard.TargetProperty="Height">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="cd0" Storyboard.TargetProperty="Width">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                                <vsm:VisualState x:Name="ExpandUp">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="Template">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderUpHeaderTemplate}"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="(Grid.Row)">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Row)">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="rd0" Storyboard.TargetProperty="Height">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="cd0" Storyboard.TargetProperty="Width">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                                <vsm:VisualState x:Name="ExpandLeft">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="Template">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ExpanderLeftHeaderTemplate}"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="(Grid.Column)">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Row)">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="rd0" Storyboard.TargetProperty="Height">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="cd0" Storyboard.TargetProperty="Width">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                                <vsm:VisualState x:Name="ExpandRight">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="Template">
                                                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.1000000" Value="{StaticResource ExpanderLeftHeaderTemplate}"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Row)">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(Grid.Column)">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="rd0" Storyboard.TargetProperty="Height">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="cd1" Storyboard.TargetProperty="Width">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="*"/>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </vsm:VisualState>
                                                            </vsm:VisualStateGroup>
                                                        </vsm:VisualStateManager.VisualStateGroups>
                                                        <Border x:Name="Background" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                                                            <Grid>
                                                                <Grid.RowDefinitions>
                                                                    <RowDefinition Height="Auto" x:Name="rd0"/>
                                                                    <RowDefinition Height="Auto" x:Name="rd1"/>
                                                                </Grid.RowDefinitions>
                                                                <Grid.ColumnDefinitions>
                                                                    <ColumnDefinition Width="Auto" x:Name="cd0"/>
                                                                    <ColumnDefinition Width="Auto" x:Name="cd1"/>
                                                                </Grid.ColumnDefinitions>
                                                                <ToggleButton Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsChecked="{TemplateBinding IsExpanded}" Margin="1" MinHeight="0" MinWidth="0" x:Name="ExpanderButton" Padding="{TemplateBinding Padding}" Template="{StaticResource ExpanderDownHeaderTemplate}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                                <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" Grid.Column="0" Grid.Row="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="ExpandSite" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Visible" Opacity="1"/>
                                                            </Grid>
                                                        </Border>
                                                        <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="3"/>
                                                        <Border x:Name="FocusVisualElement" IsHitTestVisible="false" Visibility="Collapsed" BorderThickness="1" CornerRadius="3">
                                                            <Border.BorderBrush>
                                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                    <GradientStop Color="#FFA3AEB9"/>
                                                                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                                    <GradientStop Color="#FF718597" Offset="0.375"/>
                                                                    <GradientStop Color="#FF617584" Offset="1"/>
                                                                </LinearGradientBrush>
                                                            </Border.BorderBrush>
                                                        </Border>
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Grid.Resources>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto"></RowDefinition>
                                    <RowDefinition Height="auto"></RowDefinition>
                                    <RowDefinition Height="auto"></RowDefinition>
                                    <RowDefinition Height="auto"></RowDefinition>
                                </Grid.RowDefinitions>

                                <controlsToolkit:Expander Grid.Column="0" Grid.Row="0" ExpandDirection="Down" Header="Regional Patterns" IsExpanded="False" FontStyle="Normal" FontWeight="Normal" Foreground="White">

                                    <controlsToolkit:ListBoxDragDropTarget AllowDrop="false"  VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0" Width="170">
                                        <ListBox Background="{x:Null}"  x:Name="listBoxRegionalPatternMenu" Width="170" Foreground="White" BorderBrush="{x:Null}">

                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Border BorderBrush="White" BorderThickness="1"  Width="150" CornerRadius="5" >
                                                        <StackPanel Orientation="Horizontal" >
                                                            <TextBlock Text="{Binding BioPatternName}" Margin="5,0,0,0"/>
                                                        </StackPanel>
                                                    </Border>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </controlsToolkit:ListBoxDragDropTarget>
                                </controlsToolkit:Expander>

                                <controlsToolkit:Expander Grid.Row="1"   ExpandDirection="Down" Foreground="White" Header="Recursive Patterns">
                                    <!-- Recursive patterns menu -->
                                    <controlsToolkit:ListBoxDragDropTarget AllowDrop="false" VerticalAlignment="Top"  BorderThickness="0" Width="170">
                                        <ListBox Background="{x:Null}"  x:Name="listBoxRecursivePatternMenu" Width="170" Foreground="White" BorderBrush="{x:Null}">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Border BorderBrush="White" BorderThickness="1"  Width="150" CornerRadius="5" >
                                                        <StackPanel Orientation="Horizontal" >
                                                            <TextBlock Text="{Binding BioPatternName}" Margin="5,0,0,0"/>
                                                        </StackPanel>
                                                    </Border>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </controlsToolkit:ListBoxDragDropTarget>
                                    <!-- End recursive pattern -->

                                </controlsToolkit:Expander>

                                <controlsToolkit:Expander Grid.Row="2"  ExpandDirection="Down" Foreground="White" Header="Structured Patterns">
                                    <!-- Structured patterns menu -->
                                    <controlsToolkit:ListBoxDragDropTarget AllowDrop="false" ScrollViewer.HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" BorderThickness="0" Width="170">
                                        <ListBox Background="{x:Null}"  x:Name="listBoxStructuredPatternMenu" Width="170" Foreground="White" BorderThickness="0">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Border BorderBrush="White" BorderThickness="1"  Width="150" CornerRadius="5" >
                                                        <StackPanel Orientation="Horizontal" >
                                                            <TextBlock Text="{Binding BioPatternName}" Margin="5,0,0,0"/>
                                                        </StackPanel>
                                                    </Border>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </controlsToolkit:ListBoxDragDropTarget>
                                    <!-- End structured pattern -->
                                </controlsToolkit:Expander>

                                <controlsToolkit:Expander  Grid.Row="3"  IsExpanded="False" ExpandDirection="Down" Foreground="White" Header="Special Patterns">
                                    <!-- Special patterns menu -->
                                    <controlsToolkit:ListBoxDragDropTarget AllowDrop="false" Margin="5,0,0,0" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled"  BorderThickness="0" Width="170">
                                        <ListBox Background="{x:Null}"  x:Name="listBoxSpecialPatternMenu" Width="170" Foreground="White" BorderBrush="{x:Null}">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <Border BorderBrush="White" BorderThickness="1"  Width="150" CornerRadius="5" >
                                                        <StackPanel Orientation="Horizontal" >
                                                            <TextBlock Text="{Binding BioPatternName}" Margin="5,0,0,0"/>
                                                        </StackPanel>
                                                    </Border>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>
                                    </controlsToolkit:ListBoxDragDropTarget>
                                    <!-- End special pattern -->
                                </controlsToolkit:Expander>

                            </Grid>
                        </ScrollViewer>

                    </Border>

                </Border>

                <TextBlock Height="21" FontSize="13.333" FontWeight="Bold" Foreground="#FFD6D6D6" TextWrapping="Wrap" Width="164" Canvas.Left="20" Canvas.Top="45" FontStyle="Italic"><Run Text="Available "/><Run Text="Patterns"/></TextBlock>

            </Canvas>
        </ScrollViewer>

    </Grid>
</UserControl>
